home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _RAWGETC.C < prev    next >
Text File  |  1992-11-21  |  3KB  |  72 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__rawgetc = "$Header: c:/curses/private/RCS/_rawgetc.c%v 2.0 1992/11/15 03:24:31 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_rawgetch()       - Returns the next uninterpreted character (if available).
  14.  
  15.   PDCurses Description:
  16.        Gets a character without any interpretation at all and returns
  17.        it. If keypad mode is active for the designated window,
  18.        function key translation will be performed.  Otherwise,
  19.        function keys are ignored.  If nodelay mode is active in the
  20.        window, then PDC_rawgetch() returns -1 if no character is
  21.        available.
  22.  
  23.        WARNING:  It is unknown whether the FUNCTION key translation
  24.                  is performed at this level. --Frotz 911130 BUG
  25.  
  26.   PDCurses Return Value:
  27.        This function returns OK on success and ERR on error.
  28.  
  29.   PDCurses Errors:
  30.        No errors are defined for this function.
  31.  
  32.   Portability:
  33.        PDCurses        int     PDC_rawgetch( void );
  34.  
  35. **man-end**********************************************************************/
  36.  
  37. int    PDC_rawgetch(void)
  38. {
  39. extern int     c_pindex;                       /* putter index */
  40. extern int     c_gindex;                       /* getter index */
  41. extern int     c_ungind;                       /* wungetch() push index */
  42. extern chtype  c_ungch[NUNGETCH];              /* array of ungotten chars */
  43. extern WINDOW* _getch_win_;
  44. /* extern      WINDOW* w;*/   /* w defined in wgetch() as static - _getch_win_ */
  45.                         /* is the same window - all references to w changed*/
  46.                         /* to _getch_win_ - marked with @@ */
  47.  
  48.        signed  c;
  49.        signed  oldc;
  50.  
  51.        if (_getch_win_ == (WINDOW *)NULL)   /* @@ */
  52.                return( -1 );
  53.  
  54.        if (_getch_win_->_nodelay && !typeahead(stdin)) /* @@ */
  55.                return( -1 );
  56.  
  57.        while (1)               /* loop to get valid char */
  58.        {
  59.                c = PDC_get_bios_key();
  60.                oldc = c;
  61.                /*
  62.                 * Return the key if it is not a special key.
  63.                 */
  64.                if ((c = PDC_validchar(c)) >= 0)
  65.                {               /* get & check next char */
  66.                        return( c );
  67.                }
  68.                if (_getch_win_->_use_keypad)
  69.                        return( oldc );
  70.        }
  71. }
  72.